import * as types from '../actionType'
import { getToken } from '@/utils/auth'

const initialState = {
    // token: localStorage.getItem('geek-pc-19')
    token: getToken(),
    userInfo: {}
}

export default function User(state = initialState, action) {
    switch (action.type) {
        case types.SET_TOKEN:
            return { ...state, token: action.payload }
        case types.UPDATE_USERINFO:
            return { ...state, userInfo: action.payload }
        default:
            return state
    }
}